const express = require('express')
const bodypaser = require('body-parser')
const db = require('./src/db/connect')
const path = require('path')
const app = express()
const cors = require('cors')

const userRouter = require('./src/router/userRouter')
const pushRouter = require('./src/router/pushRouter')
const fileRouter = require('./src/router/fileRouter')

const auth = require('./src/subscription/authorization')

app.use(bodypaser.urlencoded({extended: false}))
app.use(bodypaser.json())
app.use(cors())

app.use('/public', express.static(path.join(__dirname, './public')))
app.use('/user', userRouter)
app.use('/push', pushRouter)
app.use('/file', fileRouter)

app.use(auth())

app.listen(3000)
